<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('parent_id')->default(0);                 // 父级id, 分销用
            $table->string('name');
            $table->string('account')->unique();
            $table->string('password');
            $table->decimal('bonus_ratio')->default(0);               // 老师课程佣金设置
            $table->decimal('consumption_count')->default(0);         // 消费统计
            $table->integer('level_id')->default(1);
            $table->string('avatar', 255)->nullable();
            $table->decimal('balance')->default(0);
            $table->decimal('frozen_balance')->default(0);
            $table->integer('integral')->default(0);
            $table->integer('qinbi')->default(0);
            $table->integer('zhuangbi')->default(0);
            $table->string('phone', 20)->nullable();
            $table->text('details')->nullable();
            $table->rememberToken();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('users');
    }
}
